<template>
    <div class="topSearch">
        <van-search 
        v-model="value" 
        shape="round"
        background="#ffffff"
        clearable
        @search="SearchData"
        left-icon="search"
        placeholder="请输入口红测试搜索功能" />
        
    </div>
</template>

<script setup>
import { Search } from 'vant';
import { ref } from 'vue';
import { useRouter } from 'vue-router';
const router = useRouter()
const value = ref('');
const SearchData= (val)=>{
    
    if(value.value!='口红'){
        value.value = ''
        alert('请输入口红测试搜索功能')
    }else{
        // 路由传参到搜索页面
        router.push({name:'sousuof',query:{value:val}})
    }
}
</script>

<style lang="scss" scoped>
.topSearch{
    width: 100%;
    height: 3.5rem;
    // background-color: red;
    
}
</style>